Crate cloned

source ·
Expand description

See examples for what code you can write with cloned macro.

Examples

struct A {
    x: String,
    y: String,
    z: String,
}
impl A {
    fn foo(&self) {
        cloned!(self.x, self.y, self.z);
        (move || {
            println!("{} {} {}", x, y, z);
        })();
    }
}

It also supports setting a local alias:

let foo = 42;
cloned!(foo as bar);
assert!(foo == bar);

Macros

  • See crate’s documentation